package com.nami.conver.application.convertor;

import com.nami.conver.domain.pchat.model.UpdConverModel;
import com.nami.conver.facade.grpmsg.request.GrpConverCmd;
import com.nami.conver.facade.pmsg.request.PrivateConverCmd;

public class Cmd2DomainConvertor {

    public static UpdConverModel toDomain(PrivateConverCmd cmd) {
        if (cmd == null) {
            return null;
        }

        UpdConverModel msgModel = new UpdConverModel();
        msgModel.setSeq(cmd.getSeq());
        msgModel.setMessageId(cmd.getMessageId());
        msgModel.setTime(cmd.getTime());
        msgModel.setAppKey(cmd.getAppKey());
        msgModel.setSenderId(cmd.getSenderId());
        msgModel.setReceiverId(cmd.getReceiverId());
        msgModel.setRevert(Boolean.FALSE);
        return msgModel;
    }

    public static UpdConverModel toDomain(GrpConverCmd cmd) {
        if (cmd == null) {
            return null;
        }

        UpdConverModel msgModel = new UpdConverModel();
        msgModel.setSeq(cmd.getSeq());
        msgModel.setMessageId(cmd.getMessageId());
        msgModel.setTime(cmd.getTime());
        msgModel.setAppKey(cmd.getAppKey());
        msgModel.setSenderId(cmd.getSenderId());
        msgModel.setReceiverId(cmd.getReceiverId());
        msgModel.setRevert(Boolean.FALSE);
        return msgModel;
    }

}
